//
//  XQCityLocationCell.m
//  JoinPeso
//
//  Created by 小琦 on 2024/12/3.
//

#import "XQCityLocationCell.h"

@interface XQCityLocationCell()
@property (nonatomic,strong) UILabel *label;
@end

@implementation XQCityLocationCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = [UIColor clearColor];
        [self makeUI];
        [self makeConstraints];
    }
    return self;
}

- (void)makeUI {
    [self.contentView addSubview:self.label];
}

- (void)makeConstraints {
    [self.label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.right.equalTo(@0);
        make.top.equalTo(@5);
        make.height.mas_equalTo(20);
        make.bottom.equalTo(@-5);
    }];
}

#pragma mark - setter

- (void)setContent:(NSString *)content {
    self.label.text = content;
}

- (void)setIsSelected:(BOOL)isSelected {
    self.label.textColor = isSelected ? [UIColor whiteColor] : [UIColor colorWithHexString:@"#999999"];
    self.label.font = isSelected ? [UIFont systemFontOfSize:14 weight:UIFontWeightMedium] : [UIFont systemFontOfSize:14];
}

#pragma mark - lazy

- (UILabel *)label {
    if (!_label) {
        _label = [[UILabel alloc] init];
        _label.textAlignment = NSTextAlignmentCenter;
        _label.adjustsFontSizeToFitWidth = YES;
    }
    return _label;
}

@end
